const { TextToSpeechclient } = require('@google-cloud/text-to-speech')
const client = new TextToSpeechclient();
async function synthesizeText() {
    const text = '你好，世界!'
    const request = {
        input: { text },
        voice: { languageCode: 'zh-CN', ssmlGender: 'FEMALE' }, 
        audioconfig: { audioEncoding: 'MP3' },
    }
}

const [response] = await client.synthesizeAudio(request); 
const audio = response.audioContent; 
fs.writeFileSync('output.mp3', audio);

synthesizeText();